
const axios = require('axios');
const FormData = require('form-data');
axios.defaults.withCredentials = true

let mydata = new FormData();
mydata.append('Cookie', "token=it_token:1656853695.91139584578");
mydata.append('Accept', "application/json, text/plain, */*");
mydata.append('Content-Type', "application/json;charset=UTF-8");


// select * from app_fly.jygl_gnjp_flightflbb_finish
// mid_fly.factflypassenger

// base_tclivechat.chatsession_new
axios({
    method: 'POST',
    url: 'http://bds.17usoft.com/saipan/api/ergate/submit',
    data:{
        "async": true,
        "dataSourceType": "hive",
        // "executeSql": "select * from mid_hotel.hotel_flow_newubt_di where logdate=20230325 limit 10",
        "executeSql": "select * from mid_hotel.hotel_flow_newubt_di where logdate=20230325 limit 10",
        "searchType": "SELECT",
        "clearCache": false,
        "queryNotice": false,
        "tenant": "flightdap",
        "tabTitle": "Hive 2",
        "commentCheck": true,
        "dbId": null,
        "jobNum": "1002998",
        "userName": "吴文波"
    },
    headers: {
        // 'authority': 'bbs.fanruan.com',
        'method': 'POST',
        'scheme': 'http',
        'content-type': 'application/json;charset=UTF-8',
        // 'Accept-Encoding': "gzip, deflate",
        // 'Accept-Language': "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ko-KR;q=0.6,ko;q=0.5,ja-JP;q=0.4,ja;q=0.3",
        // "Cache-Control": "no-cache",
        // "Connection": "keep-alive",
        // "Content-Length": "0",
        "Cookie": `sp_access_token=94e4c4a443f0f91ee7bf2b8c8a899012; saipansession=s%3A7sO-wNZMEkyahqXFeVqdY8DMGyEa354Z.yMOARXgxAB%2FYOJLLSknLaUyVk2%2B1a%2B8XN7Tetgcun1E; __tctma=102596417.1658822012412763.1658822012453.1685629623173.1685673223645.244; __tctmu=102596417.0.0; __tctmz=102596417.1685673223645.244.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); longKey=1658822012412763; __tctrack=0; route=66e455007072e4d46f9030d9b6ce6f5c; __tctmc=102596417.28181487; __tctmd=102596417.99092941; __tctmb=102596417.1399348403579376.1685673245944.1685673245944.4`,
        // 'DNT': '1',
        // 'Host': ' tcoa.17usoft.com',
        'Origin': 'http://bds.17usoft.com',
        // 'Pragma': 'no-cache',
        'Referer': 'http://bds.17usoft.com/saipan/ergate/custom/search',
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36',
        // 'X-Requested-With': 'XMLHttpRequest'
    } 

}).then(res => {
    console.dir('save')
    console.dir(res.data)
    console.dir(res.data.simpleMessageRecordLogger.eventQueue)
    

}).catch(err => {
    console.log(err)
})


// axios({
//     method: 'POST',
//     url: 'http://bds.17usoft.com/saipan/api/ergate/submit',
//     data:{
//         "async": true,
//         "dataSourceType": "postgresql",
//         "executeSql": "select * from app_fly.jygl_marketing_observation_uv_6month",
//         "searchType": "SELECT",
//         "clearCache": false,
//         "queryNotice": false,
//         "tenant": "flightdap",
//         "tabTitle": "GreenPlum 2",
//         "commentCheck": true,
//         "dbId": 195,
//         "maxLimit": null,
//         "queryKey": "xrJaw5UY+a35RTqEd3pEAw==",
//         "jobNum": "1207174",
//         "userName": "梁鹏飞"
//     },
//     headers: {
//         // 'authority': 'bbs.fanruan.com',
//         'method': 'POST',
//         'scheme': 'http',
//         'content-type': 'application/json;charset=UTF-8',
//         // 'Accept-Encoding': "gzip, deflate",
//         // 'Accept-Language': "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ko-KR;q=0.6,ko;q=0.5,ja-JP;q=0.4,ja;q=0.3",
//         // "Cache-Control": "no-cache",
//         // "Connection": "keep-alive",
//         // "Content-Length": "0",
//         "Cookie": `sp_access_token=fd8daecc2404617631cdd16650dd4ae2; saipansession=s:QeRd5X_EVqk3aDVSYU_R-ns9TtgGd6tF.i/+M3W3qTufZtdcaPeY70vIVZm1eES04/0768FPWB3s; __tctmu=102596417.0.0; __tctmz=102596417.1680066496484.171.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); longKey=1658822012412763; __tctrack=0; route=14984ccae1c067c96887147c617a10fd; __tctma=102596417.1658822012412763.1658822012453.1680066496484.1680074641743.172; __tctmc=102596417.28181487; __tctmd=102596417.99092941; __tctmb=102596417.880712272141255.1680074641743.1680074656773.2`,
//         // 'DNT': '1',
//         // 'Host': ' tcoa.17usoft.com',
//         'Origin': 'http://bds.17usoft.com',
//         'Referer': 'http://bds.17usoft.com/saipan/ergate/custom/search',
//         'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36',
//     } 

// }).then(res => {
//     console.log('save', res.data)
// }).catch(err => {
//     console.log(err)
// })